package com.wao.product.domain;

import com.wao.base.domain.BaseMultitenantAuditingEntity;
import io.swagger.annotations.ApiModel;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.util.Objects;

/**
 * Property entity.
 *
 * @author Arthur.
 */
@ApiModel(description = "Property entity. @author Arthur.")
@Entity
@Table(name = "product_property")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class Property extends BaseMultitenantAuditingEntity {

    private static final long serialVersionUID = 1L;

    @NotNull
    @Column(name = "name", nullable = false)
    private String name;

    @NotNull
    @Column(name = "alias_enabled", nullable = false)
    private Boolean aliasEnabled;

    @NotNull
    @Column(name = "color_pro", nullable = false)
    private Boolean colorPro;

    @NotNull
    @Column(name = "enum_pro", nullable = false)
    private Boolean enumPro;

    @NotNull
    @Column(name = "input_pro", nullable = false)
    private Boolean inputPro;

    @NotNull
    @Column(name = "sku_pro", nullable = false)
    private Boolean skuPro;

    @NotNull
    @Column(name = "searchable", nullable = false)
    private Boolean searchable;

    @NotNull
    @Column(name = "filterable", nullable = false)
    private Boolean filterable;

    @NotNull
    @Column(name = "required", nullable = false)
    private Boolean required;

    @NotNull
    @Column(name = "multable", nullable = false)
    private Boolean multable;

    @NotNull
    @Column(name = "enabled", nullable = false)
    private Boolean enabled;

    @Column(name = "display_order")
    private Integer displayOrder;

    @Size(max = 8)
    @Column(name = "lang_key", length = 8)
    private String langKey;

    @NotNull
    @Column(name = "category_id", nullable = false)
    private Long categoryId;

    public String getName() {
        return name;
    }

    public Property name(String name) {
        this.name = name;
        return this;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Boolean isAliasEnabled() {
        return aliasEnabled;
    }

    public Property aliasEnabled(Boolean aliasEnabled) {
        this.aliasEnabled = aliasEnabled;
        return this;
    }

    public void setAliasEnabled(Boolean aliasEnabled) {
        this.aliasEnabled = aliasEnabled;
    }

    public Boolean isColorPro() {
        return colorPro;
    }

    public Property colorPro(Boolean colorPro) {
        this.colorPro = colorPro;
        return this;
    }

    public void setColorPro(Boolean colorPro) {
        this.colorPro = colorPro;
    }

    public Boolean isEnumPro() {
        return enumPro;
    }

    public Property enumPro(Boolean enumPro) {
        this.enumPro = enumPro;
        return this;
    }

    public void setEnumPro(Boolean enumPro) {
        this.enumPro = enumPro;
    }

    public Boolean isInputPro() {
        return inputPro;
    }

    public Property inputPro(Boolean inputPro) {
        this.inputPro = inputPro;
        return this;
    }

    public void setInputPro(Boolean inputPro) {
        this.inputPro = inputPro;
    }

    public Boolean isSkuPro() {
        return skuPro;
    }

    public Property skuPro(Boolean skuPro) {
        this.skuPro = skuPro;
        return this;
    }

    public void setSkuPro(Boolean skuPro) {
        this.skuPro = skuPro;
    }

    public Boolean isSearchable() {
        return searchable;
    }

    public Property searchable(Boolean searchable) {
        this.searchable = searchable;
        return this;
    }

    public void setSearchable(Boolean searchable) {
        this.searchable = searchable;
    }

    public Boolean isFilterable() {
        return filterable;
    }

    public Property filterable(Boolean filterable) {
        this.filterable = filterable;
        return this;
    }

    public void setFilterable(Boolean filterable) {
        this.filterable = filterable;
    }

    public Boolean isRequired() {
        return required;
    }

    public Property required(Boolean required) {
        this.required = required;
        return this;
    }

    public void setRequired(Boolean required) {
        this.required = required;
    }

    public Boolean isMultable() {
        return multable;
    }

    public Property multable(Boolean multable) {
        this.multable = multable;
        return this;
    }

    public void setMultable(Boolean multable) {
        this.multable = multable;
    }

    public Boolean isEnabled() {
        return enabled;
    }

    public Property enabled(Boolean enabled) {
        this.enabled = enabled;
        return this;
    }

    public void setEnabled(Boolean enabled) {
        this.enabled = enabled;
    }

    public Integer getDisplayOrder() {
        return displayOrder;
    }

    public Property displayOrder(Integer displayOrder) {
        this.displayOrder = displayOrder;
        return this;
    }

    public void setDisplayOrder(Integer displayOrder) {
        this.displayOrder = displayOrder;
    }

    public String getLangKey() {
        return langKey;
    }

    public Property langKey(String langKey) {
        this.langKey = langKey;
        return this;
    }

    public void setLangKey(String langKey) {
        this.langKey = langKey;
    }

    public Long getCategoryId() {
        return categoryId;
    }

    public Property categoryId(Long categoryId) {
        this.categoryId = categoryId;
        return this;
    }

    public void setCategoryId(Long categoryId) {
        this.categoryId = categoryId;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        Property property = (Property) o;
        if (property.getId() == null || getId() == null) {
            return false;
        }
        return Objects.equals(getId(), property.getId());
    }

    @Override
    public int hashCode() {
        return Objects.hashCode(getId());
    }

    @Override
    public String toString() {
        return "Property{" +
            "id=" + getId() +
            ", name='" + getName() + "'" +
            ", aliasEnabled='" + isAliasEnabled() + "'" +
            ", colorPro='" + isColorPro() + "'" +
            ", enumPro='" + isEnumPro() + "'" +
            ", inputPro='" + isInputPro() + "'" +
            ", skuPro='" + isSkuPro() + "'" +
            ", searchable='" + isSearchable() + "'" +
            ", filterable='" + isFilterable() + "'" +
            ", required='" + isRequired() + "'" +
            ", multable='" + isMultable() + "'" +
            ", enabled='" + isEnabled() + "'" +
            ", displayOrder='" + getDisplayOrder() + "'" +
            ", langKey='" + getLangKey() + "'" +
            ", categoryId='" + getCategoryId() + "'" +
            "}";
    }
}
